<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/global.css">
    <link rel="stylesheet" href="/static/css/userM.css">
    <link rel="stylesheet" href="/static/css/g-search.css">
    <link rel="shortcut icon" type="image/x-icon" href="/static/img/zhandian.ico">
    <script src="/static/lib/layui/layui.js"></script>
</head>
<body>
<div class="main">

    <div th:replace="commons/bar::topbar"></div>

    <div th:replace="commons/bar::sidebar"></div>

        <div class="mainContent">
            <header>
                <div class="search" style="display: inline-block">
                    <input type="text" name="title" placeholder="请输入搜索内容" class="search-input">
                    <span class="search-log search-btn layui-icon layui-icon-search">搜索</span>
                </div>
                <div style="display: inline-block" class="my-btn">
                    <input type="button" value="添加用户" class="layui-btn layui-btn-radius layui-btn-lg layui-btn-normal">
                </div>
            </header>
            <div class="content">
                <table class="layui-hide" id="userM-demo" lay-filter="test"></table>
                <!--操作-->
                <script type="text/html" id="barDemo">
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="detail">重置密码</a>
                </script>

                <!--//修改密码-->
                <div id="updatePass" style="display: none">
                    <form class="layui-form  layui-form-pane" lay-filter="updatePass" id="updateUser">
                        <input type="hidden" name="id">
                        <div class="layui-form-item">
                            <label class="layui-form-label">新密码</label>
                            <div class="layui-input-block">
                                <input type="text" name="passwordNewA" lay-verify="username" placeholder="请输入新密码"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">确认密码</label>
                            <div class="layui-input-block">
                                <input type="text" name="passwordNewB" lay-verify="username" placeholder="请输入新密码"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="updatePass">更改</button>
                            </div>
                        </div>
                    </form>
                </div>

                <!-- 状态-->
                <script type="text/html" id="statusTpl">
                    {{# if(d.status === 1){ }}
                    <input type="checkbox" switch_id="{{ d.id }}" lay-skin="switch" lay-text="开启|关闭" checked lay-filter="status">
                    {{# }else { }}
                    <input type="checkbox" switch_id="{{ d.id }}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status">
                    {{# } }}
                </script>

                <!-- 用户类型-->
                <script type="text/html" id="typeTpl">
                    {{# if(d.type === "admin"){ }}
                    <input type="checkbox" switch_id="{{ d.id }}" lay-skin="switch" lay-text="管理员|普通用户" checked lay-filter="type">
                    {{# }else { }}
                    <input type="checkbox" switch_id="{{ d.id }}" lay-skin="switch" lay-text="管理员|普通用户" lay-filter="type">
                    {{# } }}
                </script>

                <!--//搜索详情-->
                <div id="search-info" style="display: none">
                    <table class="layui-hide" id="search-demo" lay-filter="test"></table>
                </div>

                <!--添加用户-->
                <div id="addUser" style="display: none">
                    <form class="layui-form  layui-form-pane" id="User">
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-block">
                                <input type="text" name="username" lay-verify="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="password" lay-verify="password" placeholder="请输入用户密码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">确认密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="password1" lay-verify="password" placeholder="请输入确认密码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item" style="width:400px;">
                            <label class="layui-form-label">用户类型</label>
                            <div class="layui-input-block">
                                <select name="type" lay-verify="required">
                                    <option value="">请选择用户类型</option>
                                    <option value="user">普通用户</option>
                                    <option value="admin">管理员</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户状态</label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" value="1" title="启用" checked>
                                <input type="radio" name="status" value="0" title="停用">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="addUser">注册</button>
                                <button type="reset" class="layui-btn layui-btn-primary">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

</div>
<script>
    layui.config({
        base: '/static/js/'
    }).use('userM');
</script>
</body>
</html>